package com.capgemini.simpleappblanche.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.capgemini.simpleappblanche.dao.IAgencyDao;
import com.capgemini.simpleappblanche.domain.Agency;
import com.capgemini.simpleappblanche.utils.AbstractDaoJpaBase;

@Repository
public class AgencyDao extends AbstractDaoJpaBase<Agency, Long> implements IAgencyDao {

    /**
     * {@inheritDoc}
     * @see com.capgemini.simpleappblanche.dao.IAgencyDao#findAllActive()
     */
    @SuppressWarnings("unchecked")
    @Override
    public List<Agency> findAllActive() {
        return (List<Agency>)getEntityManager().createNamedQuery("agency.allActive").getResultList();
    }

    /**
     * {@inheritDoc}
     * @see com.capgemini.simpleappblanche.dao.IAgencyDao#findActiveByIds(java.util.List)
     */
    @SuppressWarnings("unchecked")
    @Override
    public List<Agency> findActiveByIds(List<Long> agencyIds) {
        return (List<Agency>)getEntityManager().createNamedQuery("agency.activeByIds").setParameter("agencyIds", agencyIds).getResultList();
    }
	
}
